<template>
	<view class="code-box">
		<view class="input-code">
			<view class="title">请输入8位核销码</view>
			<uv-code-input v-model="code" :maxlength="8" style="margin-left: 30rpx"></uv-code-input>
			<view class="sub-btn" :style="{'background': themeBg}" @click="confirm">确认</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: '',
				themeBg: ''
			}
		},
		onShow() {
			let theme = uni.getStorageSync('theme')
			this.themeBg = 'linear-gradient(90deg, ' + theme.bg1 + ', ' + theme.bg2 + ')'
		},
		methods: {
			// 确认核销
			confirm() {
				if (this.code == '') {
					this.$tool.error('请输入核销码')
					return
				}
				
				uni.navigateTo({
					url: '/pages/verification/detail?code=' + this.code
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.code-box {
		width: 100%;
		height: 100%;
		padding-top: 20rpx;
	}
	.input-code {
		width: calc(100% - 40rpx);
		background: #fff;
		margin: 0 auto;
		margin-top: 20rpx;
		padding: 20rpx;
		border-radius: 20rpx;
		.title {
			font-size: 36rpx;
			margin-bottom: 20rpx;
			margin-top: 20rpx;
			text-align: center;
		}
	}
	.sub-btn {
		color: #fff;
		width: 90%;
		height: 80rpx;
		line-height: 80rpx;
		text-align: center;
		border-radius: 40rpx;
		margin: 0 auto;
		margin-top: 40rpx;
		margin-bottom: 20rpx;
	}
</style>